package models

type SysRole struct {
	RoleId    int        `json:"roleId" gorm:"primaryKey;autoIncrement" uri:"id"` // 角色编码
	RoleName  string     `form:"roleName" json:"roleName" gorm:"size:128;"`       // 角色名称
	Status    int        `form:"status" json:"status" gorm:""`                    // 状态 1禁用 2正常
	RoleKey   string     `form:"roleKey" json:"roleKey" gorm:"size:128;"`         //角色代码
	RoleSort  int        `form:"roleSort" json:"roleSort" gorm:""`                //角色排序
	Flag      string     `form:"flag" json:"flag" gorm:"size:128;"`               //
	Remark    string     `form:"remark" json:"remark" gorm:"size:255;"`           //备注
	Admin     bool       `form:"admin" json:"admin" gorm:"size:4;"`
	DataScope string     `form:"dataScope" json:"dataScope" gorm:"size:128;"`
	Params    string     `json:"params" gorm:"-"`
	MenuIds   []int      `form:"menuIds" json:"menuIds" gorm:"-"`
	DeptIds   []int      `form:"deptIds" json:"deptIds" gorm:"-"`
	SysDept   []SysDept  `form:"sysDept" json:"sysDept" gorm:"many2many:sys_role_dept;foreignKey:RoleId;joinForeignKey:role_id;references:DeptId;joinReferences:dept_id;"`
	SysMenu   *[]SysMenu `form:"sysMenu" json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
	ControlBy
	ModelTime
}

func (SysRole) TableName() string {
	return "sys_role"
}
